package com.timebank.timecoin.service;

import com.timebank.timecoin.pojo.entity.User;
import org.hyperledger.fabric.gateway.Contract;
import org.hyperledger.fabric.gateway.ContractException;
import org.hyperledger.fabric.gateway.Network;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.TimeoutException;

/**
 * 智能合约服务层接口
 * @author shiliuyinzhen
 */
@Service
public interface ContractService {

    /**
     * 查询所有用户信息
     * @return
     */
    List<User> queryAll() throws ContractException;

    /**
     * 根据id查询用户信息
     * @param userId
     * @return
     */
    User getUserById(Long userId) throws ContractException;

    /**
     * 添加用户
     * @param user
     * @return
     * @throws ContractException
     * @throws InterruptedException
     * @throws TimeoutException
     */
    String createUser(User user) throws ContractException, InterruptedException, TimeoutException;

    /**
     * 更新用户信息
     * @param user
     * @return
     * @throws ContractException
     * @throws InterruptedException
     * @throws TimeoutException
     */
    String updateUser(User user) throws ContractException, InterruptedException, TimeoutException;
}
